package com.cykj.handler;


import com.cykj.service.registerService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestController
public class RegisterHandler {

    @Autowired
    private registerService registerService;
    @RequestMapping("/register")
    public Map<String,Object> Register(HttpServletRequest req) {

        Map<String,Object> map = new HashMap<>();

        String username = req.getParameter("username");
        String phone = req.getParameter("phone");
        String email = req.getParameter("email");
        String pwd = req.getParameter("pwd");


        int i = registerService.register(username, pwd, email, phone);
        if (i > 0) {

            map.put("scc",1);
            return map;
        }
        map.put("sb",0);
        return map;
    }

 }

